<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机背景颜色</title>
    <script>
        function changeBackgroundColor() {
            var randomNumber = Math.random();
            var hexString = randomNumber.toString(16);
            var randomColor = '#' + hexString.substr(0, 6);
            document.body.style.backgroundColor = randomColor;
        }
    </script>
</head>
<body onload="changeBackgroundColor()">
</body>
</html>